home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / CSPINNER / SPINDEMO.C < prev   
C/C++ Source or Header  |  1990-12-20  |  1KB  |  49 lines

  1. /*
  2.     Sample program to demonstrate the use of the CSpinner class
  3. */
  4.  
  5.  
  6. #include "CSpinner.h"
  7. #include <oops.h>
  8.  
  9. main()
  10. {
  11.     register CSpinner    *theSpinner;
  12.     register short        i;
  13.     long                ticks;
  14.  
  15.     InitGraf(&thePort);            /* Standard initialization calls        */
  16.     InitFonts();
  17.     InitWindows();
  18.     InitMenus();
  19.     TEInit();
  20.     InitDialogs(0L);
  21.     
  22.     InitCursor();                /* Start out with arrow cursor            */
  23.     
  24.                                 /* Spinner. Threshold = 1 second        */
  25.                                 /*            Interval = 0.1 seconds        */
  26.     theSpinner = new(CSpinner);
  27.     theSpinner->ISpinner(1000, 60, 6);
  28.     
  29.     for (i = 0; i < 50; i++) {    /* Spin cursor for a while                */
  30.         theSpinner->Spin();
  31.         Delay(3, &ticks);
  32.     }
  33.     
  34.                                 /* Set new delays: Threshold = 1/2 sec    */
  35.                                 /*                   Interval = 1/60 sec    */
  36.     theSpinner->SetTimes(30, 1);
  37.     theSpinner->Reset();        /* Reinitialize spin counters            */
  38.     
  39.     for (i = 0; i < 50; i++) {    /* Spin cursor for a while                */
  40.         theSpinner->Spin();
  41.         Delay(3, &ticks);        /* Loop takes 3/60 of a second, which    */
  42.                                 /*   is greater than the spin interval,    */
  43.                                 /*   so cursor will spin every pass        */
  44.                                 /*   thru the loop.                        */
  45.     }
  46.     
  47.     theSpinner->Dispose();        /* Get rid of Spinner object            */
  48. }
  49.